package ws.jdbc.concurrent.eresultset;

import java.sql.SQLException;

/**
 *
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public interface ICursor {

  public int getRow() throws SQLException;

  public boolean absolute(int row) throws SQLException;

  public void afterLast() throws SQLException;

  public void beforeFirst() throws SQLException;

  public boolean previous() throws SQLException;

  public boolean relative(int rows) throws SQLException;

  public boolean next() throws SQLException;

  public int getInt(int columnIndex) throws SQLException;

  public String getString(int columnIndex) throws SQLException;

  public float getFloat(int columnIndex) throws SQLException;

  /**
   * Moves the cursor to the insert row. The current cursor position is remembered
   * while the cursor is positioned on the insert row. The insert row is a special row
   * associated with an updatable result set. It is essentially a buffer where a new row
   * may be constructed by calling the updater methods prior to inserting the row into the
   * result set. Only the updater, getter, and {@code insertRow} methods may be called when the cursor
   * is on the insert row. All of the columns in a result set must be given a value each time this
   * method is called before calling insertRow. An updater method must be called before a getter method
   * can be called on a column value.
   *
   * @throws SQLException
   */
  public void moveToInsertRow() throws SQLException;

  public void moveToCurrentRow() throws SQLException;

  public void cancelRowUpdates() throws SQLException;

  public void updateFloat(int columnIndex, float x) throws SQLException;

  public void updateInt(int columnIndex, int x) throws SQLException;

  public void updateString(int columnIndex, String x) throws SQLException;

  public void updateRow() throws SQLException;

  public void insertRow() throws SQLException;

  public boolean isAfterLast() throws SQLException;

  public boolean isBeforeFirst() throws SQLException;

  /**
   * Lock the result set for exclusive access.
   */
  public void lock();
  /**
   * Unlock the result set.
   */
  public void unlock();
}
